import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/celery-ticket/ticket/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/celery-ticket/ticket/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/celery-ticket/ticket/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/celery-ticket/ticket/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/celery-ticket/ticket/submit',
    method: 'post',
    data: row
  })
}

export const ticketList = (current, size) => {
  return request({
    url: '/api/celery-ticket/ticket/list',
    method: 'get',
    params: {
      current,
      size
    }
  })
}

export const deleteSingleTicket = (orderId) => {
  return request({
    url: '/api/celery-ticket/ticket/delete_order',
    method: 'get',
    params: {
      orderId
    }
  })
}

/**
 * 根据id模糊查找数据
 */
export const getOrderLikeId = (id, current, size) => {
  return request({
    url: '/api/celery-ticket/ticket/get_order_likeId',
    method: 'get',
    params: {
      id,
      current,
      size
    }
  })
}

/**
 * 根据支付状态查找数据
 */
export const getPayStatusByLike = (payStatusValue, current, size) => {
  return request({
    url: '/api/celery-ticket/ticket/get_like_payStatus',
    method: 'get',
    params: {
      payStatusValue,
      current,
      size
    }
  })
}


/**
 * 根据交易状态查找数据
 */
export const getTransactionStatus = (transactionStatus, current, size) => {
  return request({
    url: '/api/celery-ticket/ticket/get_like_transaction_status',
    method: 'get',
    params: {
      transactionStatus,
      current,
      size
    }
  })
}

/**
 * 获取跳转地址
 */
export const getSendGoodUrl = (orderId) => {
  return request({
    url: '/api/celery-ticket/ticket/get_goods_url',
    method: 'get',
    params: {
      orderId: orderId
    }
  })
}

/**
 * 根据交易状态查找数据 getRefundStatus
 */
export const getRefundStatus = (refundStatus, current, size) => {
  return request({
    url: '/api/celery-ticket/ticket/get_like_refund_status',
    method: 'get',
    params: {
      refundStatus,
      current,
      size
    }
  })
}


/**
 * 根据条件进行商品查找 
 */
export const getTicketByCondition = (mydata) => {
  return request({
    url: '/api/celery-ticket/ticket/get_ticket_by_condition',
    method: 'post',
    data: mydata
  })
}

/**
 * 店铺筛选的下拉接口 /get_shop_select_data
 */
export const getShopSelectData = (mydata) => {
  return request({
    url: '/api/celery-ticket/ticket/get_shop_select_data',
    method: 'get'
  })
}


/**
 * 根据订单（以卖家为己方去获取买家信息) get_trade_seller_view
 */
export const getTradeSellerView = (orderId) => {
  return request({
    url: '/api/celery-ticket/ticket/get_trade_seller_view',
    method: 'get',
    params: {orderId}
  })
}

/**
 * 返回订单信息相关的接口 /get_buyer_info
 */
export const getBuyerInfo = (orderId) => {
  return request({
    url: '/api/celery-ticket/ticket/get_buyer_info',
    method: 'get',
    params: {orderId}
  })
}